package org.kiwi.data.enums;

import org.springframework.util.Assert;

/**
 * Created by jack on 16/10/30.
 */
public enum PoolType {
    DRUID("druid"), C3P0("c3p0"), DBCP("dbcp");

    private String text;

    PoolType(String text) {
        this.text = text;
    }

    public String getText() {
        return text;
    }

    public static PoolType determinePoolTypeByText(String text) {
        Assert.hasText(text, "text is required");

        for (PoolType poolType : PoolType.values()) {
            if (poolType.getText().equalsIgnoreCase(text))
                return poolType;
        }

        return DRUID;
    }
}
